﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;

namespace Classes
{
    public static class LevelHelper
    {
        public static Dictionary<int, List<string>> Levels;
        private static string levelsFile = "Files/levels.txt";

        public static void load()
        {
            Levels = new Dictionary<int, List<string>>();

            //var myStore = IsolatedStorageFile.GetUserStoreForApplication();
            Stream str = Application.GetResourceStream(new Uri(@"/MemoBoss;component/" + levelsFile, UriKind.Relative)).Stream;

            using (StreamReader sr = new StreamReader(str))
            {
                int levelNo = 0;
                List<string> levelLines = new List<string>();
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                    if (line.StartsWith("Level "))
                    {
                        levelLines = new List<string>();
                        levelNo = int.Parse(line.Replace("Level ", ""));
                        Levels.Add(levelNo, levelLines);
                        //if (levelLines.Count != 0)
                        //{
                            
                           
                        //}
                    }
                    else
                    {
                        levelLines.Add(line);
                    }

                }
               // Levels.Add(levelNo, levelLines);
                sr.Close();
            }



        }

    }
}
